package com.explorati.interview.interview.chaptereight;

public class SyncTest {

	public static void main(String[] args) {
		new MyThread().start();
		new MyThread().start();
		new MyThread().start();
	}
}
/**
 * 未加synchronized时：
 Thread-0 : 0
Thread-0 : 2
Thread-0 : 3
Thread-0 : 4
Thread-0 : 5
Thread-1 : 1
Thread-2 : 6
Thread-2 : 7
Thread-2 : 9
Thread-1 : 8
Thread-2 : 10
Thread-1 : 11
Thread-1 : 13
Thread-1 : 14
Thread-2 : 12
*/

/*
 * 加入synchronized后：
 * Thread-0 : 0
Thread-0 : 1
Thread-0 : 2
Thread-0 : 3
Thread-0 : 4
Thread-1 : 5
Thread-1 : 6
Thread-1 : 7
Thread-1 : 8
Thread-1 : 9
Thread-2 : 10
Thread-2 : 11
Thread-2 : 12
Thread-2 : 13
Thread-2 : 14
*/
